package com.ft.oa.enums;

/**
 * 代办、审批相关配置
 * 1、合同审批 2、协同审批 3、投标审批  4、立项审批  5、验收审批   6、成本变更审批  7、进度变更审批  8、研发立项审批  9、采购审批
 */
public enum ApprovalParams {

    //初始化参考4-立项审批
    CONTRACT(1,"合同审批","","",""),
    SYNERGY(2,"协同审批","","",""),
    TENDER(3,"投标审批","bid_project","bid_name","approval_status"),
    PROJECT(4,"立项审批","exec_project","name","approval_status"),
    BUDGET(5,"验收审批","exec_project_examine","project_name","approval_status"),
    COST(6,"成本变更审批","","",""),
    SCHEDULE(7,"进度变更审批","","",""),
    DEVELOPMENT(8,"研发立项审批","dev_allocate","dev_allocate_name","approval_status"),
    PROCUREMENT(9,"采购审批","","",""),
    ;

    //名称
    private String name;
    //编码
    private int code;
    //业务表--表名
    private String table;
    //业务名称--对应数据库业务表字段名
    private String businessNameColumn;
    //审批状态--对应业务表审批字段名（用以更新字段状态）
    private String approvalColumn;
    //构造函数
    ApprovalParams(int code, String name, String table, String businessNameColumn, String approvalColumn){
        this.code = code;
        this.name = name;
        this.table = table;
        this.approvalColumn = approvalColumn;
        this.businessNameColumn = businessNameColumn;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getTable() {
        return table;
    }

    public void setTable(String table) {
        this.table = table;
    }

    public String getBusinessNameColumn() {
        return businessNameColumn;
    }

    public void setBusinessNameColumn(String businessNameColumn) {
        this.businessNameColumn = businessNameColumn;
    }

    public String getApprovalColumn() {
        return approvalColumn;
    }

    public void setApprovalColumn(String approvalColumn) {
        this.approvalColumn = approvalColumn;
    }

    /**
     * 获取枚举对象
     * @param code
     * @return
     */
    public static ApprovalParams getByCode(int code) {
        for (ApprovalParams value : ApprovalParams.values()) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }
}
